CalicCRC(uint8_t *buf, uint16_t count)
{
	uint16_t CRCV = 0xFFFF;
	uint16_t iB, i, j;
	for (i = 0; i < count; i++)
	{
		CRCV ^= *buf++;
		for (j = 0; j < 8; j++)
		{
			iB = (uint8_t)(CRCV & 0x0001);
			CRCV = (uint16_t)(CRCV >> 1);
			if (iB == 1)
				CRCV = (uint16_t)(CRCV ^ 0xA001);
		}
	}
	return CRCV;
}
